package com.tpc.control.jpa;

import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.JoinColumns;
import javax.persistence.ManyToOne;
import javax.persistence.Table;

/**
 * PlanGreige entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name = "plan_greige", catalog = "production_control")
public class PlanGreige implements java.io.Serializable {

	// Fields

	private PlanGreigeId id;
	private SaleData saleData;
	private CommonData commonData;
	private String remark;

	// Constructors

	/** default constructor */
	public PlanGreige() {
	}

	/** full constructor */
	public PlanGreige(PlanGreigeId id, SaleData saleData,
			CommonData commonData, String remark) {
		this.id = id;
		this.saleData = saleData;
		this.commonData = commonData;
		this.remark = remark;
	}

	// Property accessors
	@EmbeddedId
	@AttributeOverrides( {
			@AttributeOverride(name = "saleOrder", column = @Column(name = "sale_order", nullable = false, length = 20)),
			@AttributeOverride(name = "saleItem", column = @Column(name = "sale_item", nullable = false, length = 6)) })
	public PlanGreigeId getId() {
		return this.id;
	}

	public void setId(PlanGreigeId id) {
		this.id = id;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns( {
			@JoinColumn(name = "sale_order", referencedColumnName = "sale_order", nullable = false, insertable = false, updatable = false),
			@JoinColumn(name = "sale_item", referencedColumnName = "sale_item", nullable = false, insertable = false, updatable = false) })
	public SaleData getSaleData() {
		return this.saleData;
	}

	public void setSaleData(SaleData saleData) {
		this.saleData = saleData;
	}

	@ManyToOne(fetch = FetchType.LAZY)
	@JoinColumns( {
			@JoinColumn(name = "production_no", referencedColumnName = "production_no", nullable = false),
			@JoinColumn(name = "seq", referencedColumnName = "seq", nullable = false) })
	public CommonData getCommonData() {
		return this.commonData;
	}

	public void setCommonData(CommonData commonData) {
		this.commonData = commonData;
	}

	@Column(name = "remark", nullable = false, length = 256)
	public String getRemark() {
		return this.remark;
	}

	public void setRemark(String remark) {
		this.remark = remark;
	}

}